<?php
		if(true){
		//page_1
			if ($_GET['page']) {
				$page = $_GET['page'];
				if(is_numeric($page)){
				}else{
					$page = 1;
				}
			} else {
				$page = 1;
			}
			$per_page = 10;//每页显示20条
			if($page<=1){$page=1;}//最大值还没有设置,在后面的db结果设置
			$start_from = ($page-1)*$per_page;
		}


?>
<?php
/*
 * Created on 2011-11-9
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
 if($_SESSION['user_id']){
$userid = $_SESSION['user_id'];
}else{
	  echo "<script>alert('请先登录!');location='../login.php';</script>";
}



            $userid = $_SESSION['user_id'];
            $current_url = $_SERVER['PHP_SELF'].'?main=guanzhu_xiaoqu';
            $userid = $_SESSION['user_id'];
			require_once ("./includes/func.php");
         	require_once("./includes/configure.php");
			require_once("./includes/database.php");

			$db = Database::Connect();

		       if(true){
			//page_2
				$count_sql = "select count(*) from xiaoqu where this_id in (select shoucang_dongxi_id from shoucang where user_id=$userid and shoucang_leixing=3)";

				$count_result = $db->GetResultSet($count_sql);
				while ($count_row = mysql_fetch_array($count_result)) {
					$total_item = $count_row[0];
				}
				$max_page = ceil($total_item/$per_page);
			}
			$sql = "select * from xiaoqu where this_id in (select shoucang_dongxi_id from shoucang where user_id=$userid and shoucang_leixing=3)";//默认0为出租
			$sql.=" order by this_id desc limit $start_from,$per_page";
		    $xiaoqurows = $db->GetResultSet($sql)  or die ("出错啦!");


?>
<div class="right_container">
	        <div id="MyAnjuke">
	<div class="tab">
        <h1>
        <dl><dt class="tL"></dt><dt class="t0">收藏的小区</dt><!-- <dt class="refresh"><a href="http://my.anjuke.com/community/concerned/W0QQpZ0">刷新</a></dt> --><dt class="tR"></dt></dl>
        </h1>
	</div>
	<div class="show">
        	<div class="p2974">
<?php

			while ($row = mysql_fetch_array($xiaoqurows)) {



				$id = $row['this_id'];

				$xiaoquming = $row['xiaoquming'];

				$dizhi = $row['dizhi'];

				$ditie = $row['ditie'];

				$gongjiao = $row['gongjiao'];

				$tupian = $row['tupian'];

				$wuyeleixing = $row['wuyeleixing'];

				$jungongshijian = $row['jugongshijian'];

				$kaifashang = $row['kaifashang'];

				$wuyegongsi = $row['wuyegongsi'];

				$wuyefei = $row['wuyefei'];

				$gaikuang = $row['gaikuang'];

				$tingchewei = $row['tingchewei'];

				$lvhualv = $row['lvhualv'];

				$rongjilv = $row['rongjilv'];

				$zongjianzhumianji = $row['zongjianzhumianji'];

				$jiage = $row['jiage'];


				$zufang = $db->GetCount("select * from zufang where xiaoqu=$id and type=0");

				$ershoufang = $db->GetCount("select * from zufang where xiaoqu=$id and type=1");



?>
                                <div onmouseout="this.className='box'" onmouseover="this.className='box boxv'" _onclick="window.open('#');" class="box">
                	<div style="display:none;" class="boxdialogs" id="del_box_0_apf_id_1">
                    	<div class="boxdialog">
                        	<p class="x2"><code onclick="document.getElementById('del_box_0_apf_id_1').style.display='none';" title="关闭"></code></p>
                        	<p>确定要删除选中的小区吗？</p>
                            <p>
                            <input type="hidden" value="56996">
                           <input type="button" onclick="window.location='shoucang.php?action=cancle&sc_type=3&dx_id=<?php echo $id;?>';
                           document.getElementById('del_box_0_apf_id_1').style.display='none'" value=" 确定 "><input type="button" class="hid"><input type="button" onclick="document.getElementById('del_box_0_apf_id_1').style.display='none'" value=" 取消 "></p>
                        </div>
                    </div>
                	<div onclick="document.getElementById('del_box_0_apf_id_1').style.display='block'" title="删除" class="x"></div>
                    <a target="_blank" href="#"><img class="propimg" src="http://images2.anjukestatic.com/community/20081215/3/36/35/96/3363596/100x75.jpg"></a>
                    <div class="propinfo">
                    	<p class="p1"><a target="_blank" href="xiaoqu_xiangqing.php?id=<?php echo $id?>" id="stopClick_apf_id_1"><?php echo $xiaoquming?></a></p>
                        <p><?php echo $xiaoqudizhi?></p>
                    </div>
                    <div class="saleprice"><em><?php echo $jiage?></em>&nbsp;元/平米</div>

                </div>


                <?php }?>
                		        <div style="display:none;" class="clear_all"><a class="report" id="rpt_apf_id_1" href="javascript:">清除全部</a></div>
				<div style="display:none" class="dialog" id="apf_id_11">
<div class="view_prop_popup_rpt" id="popup_apf_id_11">
    <div class="content">
        <form action="http://my.anjuke.com/community/concerned/W0QQactZdelall" method="POST" id="rptForm">
            <input type="hidden" value="1" name="submittype" id="submittype">
            <div><span class="close"><img border="0" src="http://pages.anjukestatic.com/img/reg/icon.close_8x9.gif"></span></div>
            <div class="msg">
                <div>你确定要删除全部收藏的小区吗？</div>
                <div class="button"><div onclick="$('rptForm').submit();;">确定</div><div class="close">取消</div></div>
            </div>
        </form>
    </div>
</div>
</div>
                                         	<?php if(true){
	//page_3
?>
<div class="multipage">

	<?php
		if($page!=1){
			echo '<a class="prv" href="'.deleteRepeatVar($current_url,'page').'&page='.($page-1).'"><span>上一页</span></a>';
		}
		if($max_page>10){
			$ind = $page-5;
		}
		if($ind<=0){
			$ind=1;
		}
		$page_show_total = 10;//最多显示10页
		for(;$ind<=$max_page;$ind++){
			if($ind==$page){
				echo '<strong><span>'.$ind.'</span></strong>';
			}else{
				echo '<a href="'.deleteRepeatVar($current_url,'page').'&page='.$ind.'"><span>'.$ind.'</span></a>';
			}
			$page_show_total--;
			if($page_show_total==0){
				break;
			}
		}
	   if($page!=$max_page && $max_page!=0){
			echo '<a class="next" href="'.deleteRepeatVar($current_url,'page').'&page='.($page+1).'"><span>下一页</span></a>';
		}
		if($total_item==0){
				echo "你还没收藏的小区信息哦，快去看看感兴趣的小区吧！<a href='ershoufang.php'>小区信息</a>";
		}
	?>
			</div>

<?php }
$db->Close();
?>





</div>

	    </div>
